/*    */ package com.zimbra.cs.account.callback;
/*    */ 
/*    */ import com.zimbra.common.service.ServiceException;
/*    */ import com.zimbra.common.util.Log;
/*    */ import com.zimbra.common.util.ZimbraLog;
/*    */ import com.zimbra.cs.account.AttributeCallback;
/*    */ import com.zimbra.cs.account.Entry;
/*    */ import com.zimbra.cs.account.Provisioning;
/*    */ import com.zimbra.cs.account.Server;
/*    */ import com.zimbra.cs.mailbox.PurgeThread;
/*    */ import com.zimbra.cs.util.Zimbra;
/*    */ import java.util.Map;
/*    */ import java.util.Set;
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ public class MailboxPurge
/*    */   extends AttributeCallback
/*    */ {
/*    */   public void preModify(CallbackContext context, String attrName, Object attrValue, Map attrsToModify, Entry entry) {}
/*    */   
/*    */   public void postModify(CallbackContext context, String attrName, Entry entry)
/*    */   {
/* 43 */     if (!"zimbraMailPurgeSleepInterval".equals(attrName)) {
/* 44 */       return;
/*    */     }
/*    */     
/*    */ 
/* 48 */     if (!Zimbra.started()) {
/* 49 */       return;
/*    */     }
/* 51 */     Server localServer = null;
/*    */     try
/*    */     {
/* 54 */       localServer = Provisioning.getInstance().getLocalServer();
/*    */     } catch (ServiceException e) {
/* 56 */       ZimbraLog.misc.warn("unable to get local server");
/* 57 */       return;
/*    */     }
/*    */     
/* 60 */     boolean hasMailboxService = localServer.getMultiAttrSet("zimbraServiceEnabled").contains("mailbox");
/*    */     
/* 62 */     if (!hasMailboxService) {
/* 63 */       return;
/*    */     }
/* 65 */     if ((entry instanceof Server)) {
/* 66 */       Server server = (Server)entry;
/*    */       
/* 68 */       if (server.getId() != localServer.getId()) {
/* 69 */         return;
/*    */       }
/*    */     }
/* 72 */     ZimbraLog.purge.info("Mailbox purge interval set to %s.", new Object[] { localServer.getAttr("zimbraMailPurgeSleepInterval", null) });
/*    */     
/* 74 */     long interval = localServer.getTimeInterval("zimbraMailPurgeSleepInterval", 0L);
/* 75 */     if ((interval > 0L) && (!PurgeThread.isRunning())) {
/* 76 */       PurgeThread.startup();
/*    */     }
/* 78 */     if ((interval == 0L) && (PurgeThread.isRunning())) {
/* 79 */       PurgeThread.shutdown();
/*    */     }
/*    */   }
/*    */ }


/* Location:              /home/mint/zimbrastore.jar!/com/zimbra/cs/account/callback/MailboxPurge.class
 * Java compiler version: 7 (51.0)
 * JD-Core Version:       0.7.1
 */